package com.lixinlei.springboot_servlet.servlet.webservlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(urlPatterns = "/my/web/servlet")
public class MyWebServlet extends HttpServlet {

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        System.out.println("**************com.lixinlei.springboot_servlet.servlet.myservlet.MyServlet.doGet()**************");
        PrintWriter out = resp.getWriter();
        resp.setContentType("text/html;charset=utf-8");
        out.println("<strong>Get My Web Servlet!</strong><br>");
    }

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        System.out.println("**************com.lixinlei.springboot_servlet.servlet.myservlet.MyServlet.doPost()**************");
        PrintWriter out = resp.getWriter();
        resp.setContentType("text/html;charset=utf-8");
        out.println("<strong>Post My Web Servlet!</strong><br>");
    }

}
